SQL by Andy Oppel
Author:Andy Oppel
Language: eng
Format: epub
Publisher: McGraw-Hill Education
Published: 2016-04-12T04:00:00+00:00
The SELECT statement produces exactly the same results as the preceding statement, only now the tables are referenced by different names, except in the FROM clause. In fact, you use the FROM clause to define the aliases that are used in the rest of the statement. In this case, the CD_INVENTORY table is renamed c, and the PERFORMERS table is renamed p. As a result, c and p must be used everywhere else in the SELECT statement when referring to those tables. Once a correlation name has been defined, you cannot use the actual table name. And yes, this can be confusing because you use the alias in the SELECT clause, but it is not defined until the FROM clause that follows the SELECT clause.
To better understand how the renaming process works, let’s revisit the issue of how SELECT statements are processed. As you might recall from Chapter 7, the FROM clause is processed first and the SELECT clause is processed last. That is why the correlation names are defined in the FROM clause. Once they are defined, all other clauses can (and must) use those aliases when qualifying column references. The correlation names are used throughout the remainder of the statement, but they only apply to the statement in which they are defined. If you create a new SELECT statement, you must redefine those names in order to use them in the new statement.
As you can see in the previous SELECT statement, a correlation name is defined immediately after the actual table name. The new name follows the AS keyword. However, the AS keyword is not required. In most implementations, you can also use the following convention to rename the tables within a query:
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(8296)
Azure Data and AI Architect Handbook by Olivier Mertens & Breght Van Baelen(6722)
Building Statistical Models in Python by Huy Hoang Nguyen & Paul N Adams & Stuart J Miller(6700)
Serverless Machine Learning with Amazon Redshift ML by Debu Panda & Phil Bates & Bhanu Pittampally & Sumeet Joshi(6572)
Data Wrangling on AWS by Navnit Shukla | Sankar M | Sam Palani(6357)
Driving Data Quality with Data Contracts by Andrew Jones(6306)
Machine Learning Model Serving Patterns and Best Practices by Md Johirul Islam(6073)
Learning SQL by Alan Beaulieu(5994)
Weapons of Math Destruction by Cathy O'Neil(5778)
Big Data Analysis with Python by Ivan Marin(5356)
Data Engineering with dbt by Roberto Zagni(4352)
Solidity Programming Essentials by Ritesh Modi(4000)
Time Series Analysis with Python Cookbook by Tarek A. Atwan(3858)
Pandas Cookbook by Theodore Petrou(3569)
Blockchain Basics by Daniel Drescher(3292)
Hands-On Machine Learning for Algorithmic Trading by Stefan Jansen(2905)
Feature Store for Machine Learning by Jayanth Kumar M J(2812)
Learn T-SQL Querying by Pam Lahoud & Pedro Lopes(2794)
Mastering Python for Finance by Unknown(2744)
